<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <input type="button" @click="checkType">反选
        <ul>
            <li v-for="(item,index) in hero">
                <input type="checkbox" :value="item" name="" id="" v-model="arr">{{item}}

            </li>
        </ul>
        <div>{{arr}}</div>
    </div>


    <script src="../../2023-4-13/node/js/vue.js"></script>
    <script>
        // 创建新的vue  渲染数据不需要获取节点 
        var app = new Vue({
            el: '#app',//将vue挂载在节点上
            data: {
                // hero: [
                //     { name: '酷奇', flag: false },
                //     { name: '拉拉', flag: false },
                //     { name: 'ssss', flag: false }]
                hero: ['彩票', "电视", "飞机", "电脑", "航空母舰"],
                arr: []


            },
            methods: {
                checkType() {
                    // this.hero.forEach(item => { item.flag = !item.flag });
                    this.arr = this.hero.filter(item => {
                        return this.arr.indexOf(item) == -1
                    })

                },
                // checkAllfn() {
                //     if (this.checkall) {
                //         this.hero.map((item, index) => {
                //             this.arr = []
                //         })
                //     }
                // }
            }

        })
    </script>
</body>

</html>